package com.yogee.topseller.activity.login.view.impl;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;


import com.umeng.analytics.MobclickAgent;
import com.yogee.topseller.R;
import com.yogee.topseller.activity.base.HttpActivity;
import com.yogee.topseller.fragment.TiyanFragment;
import com.yogee.topseller.utils.AppUtil;
import com.yogee.topseller.utils.Constants;

import butterknife.BindView;
import butterknife.OnClick;

public class GuideLoginRegist extends HttpActivity {

    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.rl_title_layout)
    RelativeLayout rlTitleLayout;
    @BindView(R.id.tv_go_login)
    TextView tvGoLogin;
    @BindView(R.id.tv_go_register)
    TextView tvGoRegister;
    private String isSetting;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_guide_login_regist;
    }

    @Override
    protected void initView() {
        if (getIntent() != null) {
            isSetting = getIntent().getStringExtra("isSetting");
        }
        if (!TextUtils.isEmpty(isSetting) && isSetting.equals("1")){
            ivBack.setVisibility(View.GONE);
        }
    }

    @OnClick({R.id.iv_back, R.id.tv_go_login, R.id.tv_go_register})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                if (AppUtil.isFastDoubleClick(1000)) {
                    return;
                }
                finish();
                break;
            //GoLogin
            case R.id.tv_go_login:
                if (AppUtil.isFastDoubleClick(1000)) {
                    return;
                }
                MobclickAgent.onEvent(GuideLoginRegist.this, "loginBtn");
                startActivity(new Intent(GuideLoginRegist.this, LoginActivity.class));

//                TiyanFragment freeFragment = new TiyanFragment();
//                Bundle args = new Bundle();
//                args.putString("day", "1");
//                freeFragment.setArguments(args);
//                freeFragment.setCancelable(false);
//                freeFragment.show(getFragmentManager(),"");
                break;
            //GoRegister
            case R.id.tv_go_register:
                if (AppUtil.isFastDoubleClick(1000)) {
                    return;
                }
                MobclickAgent.onEvent(GuideLoginRegist.this, "regBtn");
                startActivity(new Intent(GuideLoginRegist.this, ForgetPswActivity.class).putExtra("flag", Constants.FLAG_REGIST));
                break;
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        MobclickAgent.onResume(this);
    }

    @Override
    protected void onPause() {
        super.onPause();
        MobclickAgent.onPause(this);
    }
}